
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>CentOS 7安装完第一步：yum源配置 | 安生</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="最近刚刚把系统换成CentOS 7，搜索了一下，关于CentOS7的新手入门的文章不多，就整理了一下我装完CentOS后做的一些东西，一边是为自己以后查询方便，一边给大家作参考。有问题欢迎指出，谢谢。
 首先，装完CentOS，肯定是先配置yum源，关闭不用的服务软件，安装一些常用的软件。
 好，开始第一步，配置yum源。
官方源：
   CentOS自带了四个官方的源，默认的打开的有base,">
<meta property="og:type" content="article">
<meta property="og:title" content="CentOS 7安装完第一步：yum源配置">
<meta property="og:url" content="http://localhost/2014/11/26/CentOS-7安装完第一步：yum源配置/index.html">
<meta property="og:site_name" content="安生">
<meta property="og:description" content="最近刚刚把系统换成CentOS 7，搜索了一下，关于CentOS7的新手入门的文章不多，就整理了一下我装完CentOS后做的一些东西，一边是为自己以后查询方便，一边给大家作参考。有问题欢迎指出，谢谢。
 首先，装完CentOS，肯定是先配置yum源，关闭不用的服务软件，安装一些常用的软件。
 好，开始第一步，配置yum源。
官方源：
   CentOS自带了四个官方的源，默认的打开的有base,">
<meta property="og:updated_time" content="2016-04-11T05:46:51.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CentOS 7安装完第一步：yum源配置">
<meta name="twitter:description" content="最近刚刚把系统换成CentOS 7，搜索了一下，关于CentOS7的新手入门的文章不多，就整理了一下我装完CentOS后做的一些东西，一边是为自己以后查询方便，一边给大家作参考。有问题欢迎指出，谢谢。
 首先，装完CentOS，肯定是先配置yum源，关闭不用的服务软件，安装一些常用的软件。
 好，开始第一步，配置yum源。
官方源：
   CentOS自带了四个官方的源，默认的打开的有base,">
  
    <link rel="alternative" href="/atom.xml" title="安生" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link rel="stylesheet" href="/css/style.css">
  <link href="//fonts.useso.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script><![endif]-->
  
</head>
<body>
<div id="container">
  <div id="wrap">
    <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">安生</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="http://www.baidu.com/baidu" method="get" accept-charset="utf-8" class="search-form">
          <input type="search" name="word" maxlength="20" class="search-form-input" placeholder="Search">
          <input type="submit" value="" class="search-form-submit">
          <input name=tn type=hidden value="bds">
          <input name=cl type=hidden value="3">
          <input name=ct type=hidden value="2097152">
          <input type="hidden" name="si" value="localhost">
        </form>
      </div>
    </div>
  </div>
</header>
    <div class="outer">
      <section id="main"><article id="post-CentOS-7安装完第一步：yum源配置" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/11/26/CentOS-7安装完第一步：yum源配置/" class="article-date">
  <time datetime="2014-11-25T22:36:00.000Z" itemprop="datePublished">2014-11-26</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      CentOS 7安装完第一步：yum源配置
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>最近刚刚把系统换成<span style="font-family:Arial;">CentOS 7</span><span style="font-family:宋体;">，搜索了一下，关于</span><span style="font-family:Arial;">CentOS7</span><span style="font-family:宋体;">的新手入门的文章不多，就整理了一下我装完</span><span style="font-family:Arial;">CentOS</span><span style="font-family:宋体;">后做的一些东西，一边是为自己以后查询方便，一边给大家作参考。有问题欢迎指出，谢谢。</span></span></p>
<p><span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>首先，装完<span style="font-family:Arial;">CentOS</span><span style="font-family:宋体;">，肯定是先配置</span><span style="font-family:Arial;">yum</span><span style="font-family:宋体;">源，关闭不用的服务软件，安装一些常用的软件。</span></span></p>
<p><span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>好，开始第一步，配置<span style="font-family:Arial;">yum</span><span style="font-family:宋体;">源。</span></span></p>
<p><span style="font-size:10.5pt;font-family:Arial;">官方源：</span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>CentOS<span style="font-family:宋体;">自带了四个官方的源，默认的打开的有</span><span style="font-family:Arial;">base,updates</span><span style="font-family:宋体;">和</span><span style="font-family:Arial;">extras</span><span style="font-family:宋体;">，官方源里的软件兼容性和稳定性是最好的（</span><span style="font-family:Arial;">ps:</span><span style="font-family:宋体;">貌似这是废话。。。），当然呢，官方源中也去除了很多有版权争议的软件，安装的软件也不一定不是最新的。由于刚刚安装好的系统都是直接用的官方服务器进行软件下载升级，速度是个问题。所以呢，我们可以更换为国内的镜像服务器。</span></span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>方法很简单，首先先备份系统的那啥，</span><span style="color:rgb(51, 51, 51);font-size:10.5pt;font-family:'Helvetica Neue';"><strong>CentOS-Base.repo</strong> </span><span style="font-size:10.5pt;font-family:Arial;">。</span></p>
<pre><code>sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
`&lt;/pre&gt;

&lt;span style=&quot;font-size:10.5pt;font-family:Arial;&quot;&gt;&lt;span style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;然后呢，我使用的是中国科学技术大学提供的镜像，比较懒，直接&lt;span style=&quot;font-family:Arial;&quot;&gt;down&lt;/span&gt;&lt;span style=&quot;font-family:宋体;&quot;&gt;的他们的配置文件。&lt;/span&gt;&lt;/span&gt;

  &lt;span style=&quot;font-size:10.5pt;font-family:Arial;&quot;&gt;&lt;span style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;直接把国内的几个都贴上来:&lt;/span&gt;
</code></pre><ul>
<li><span style="font-family: Arial; font-size: 9pt;">网易的源：</span><span style="font-family: Arial; font-size: 9pt;"><a href="http://mirrors.163.com/centos/" target="_blank" rel="external">http://mirrors.163.com/centos/</a></span></li>
<li><span style="font-family: Arial; font-size: 9pt;">阿里的源：</span><span style="font-family: Arial; font-size: 9pt;"><a href="http://mirrors.aliyun.com/centos/" target="_blank" rel="external">http://mirrors.aliyun.com/centos/</a></span></li>
<li><span style="font-family: Arial; font-size: 9pt;">搜狐的源：</span><span style="font-family: Arial; font-size: 9pt;"><a href="http://mirrors.sohu.com/centos/" target="_blank" rel="external">http://mirrors.sohu.com/centos/</a></span></li>
<li><span style="font-family: Arial; font-size: 9pt;">上海交大：</span><span style="font-family: Arial; font-size: 9pt;"><a href="http://ftp.sjtu.edu.cn/centos/" target="_blank" rel="external">http://ftp.sjtu.edu.cn/centos/</a></span></li>
<li><p><span style="font-family: Arial; font-size: 9pt;">中国科学技术大学的：</span><span style="font-family: Arial; font-size: 9pt;"><a href="http://mirrors.ustc.edu.cn/centos/" target="_blank" rel="external">http://mirrors.ustc.edu.cn/centos/</a></span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>使用方法，懒得改，直接<span style="font-family:Arial;">down</span><span style="font-family:宋体;">镜像站提供的配置文件然后复制到配置文件所在目录。这里，以中国科学技术大学的为例（</span><span style="font-family:Arial;">ps</span><span style="font-family:宋体;">：因为它直接提供了</span><span style="font-family:Arial;">CentOS7</span><span style="font-family:宋体;">的配置文件，偷笑</span><span style="font-family:Arial;">ing</span><span style="font-family:宋体;">）</span></span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>如果要改为其他的源，</span><span style="font-size:9pt;font-family:Arial;">直接改对应的<span style="font-family:Arial;">baseurl</span><span style="font-family:宋体;">即可。</span></span></p>
<pre>`# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
`</pre>

<p><span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>先把这个文件内容复制保存为</span><span style="font-size:9pt;font-family:宋体;">CentOS-Base.repo</span><span style="font-size:9pt;font-family:Arial;">在电脑上，<span style="font-family:Arial;">bash</span><span style="font-family:宋体;">切到你保存的目录，然后</span></span></p>
<p><span style="font-size:9pt;font-family:Arial;"><span style="font-family:宋体;"></span></span></p>
<pre>`sudo mv CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
sudo yum makecache
`</pre>

<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>就好了。</span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>发现一个不错的网站，提供了一大堆国内<span style="font-family:Arial;">CentOS</span><span style="font-family:宋体;">镜像，链接在这里：</span></span><a href="http://www.centoscn.com/yunwei/news/2012/1227/131.html" target="_blank" rel="external"><span style="color:rgb(0, 0, 255);font-size:10.5pt;font-family:Arial;">中国<span style="font-family:Arial;">linux</span><span style="font-family:宋体;">开源镜像站大全</span></span></a></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;">第三方源：</span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>EPEL<span style="font-family:宋体;">源</span></span></p>
<p>  <span style="font-size: 10.5pt;"><span style="font-family: Arial; white-space: pre;"> </span><span style="font-family:Arial;">企业版</span><span style="font-family: Arial;">Linux</span><span style="font-family: 宋体;">附加软件包</span><span style="font-family: Arial;">(</span><span style="font-family: 宋体;">以下简称</span><span style="font-family: Arial;">EPEL)</span><span style="font-family: 宋体;">是一个由特别兴趣小组创建、维护并管理的，针对红帽企业版</span><span style="font-family: Arial;">Linux(RHEL)</span><span style="font-family: 宋体;">及其衍生发行版</span><span style="font-family: Arial;">(</span><span style="font-family: 宋体;">比如</span><span style="font-family: Arial;">CentOS、</span><span style="font-family: Arial;">Scientific Linux</span><span style="font-family:宋体;">、</span><span style="font-family: Arial;">Oracle Enterprise Linux)</span><span style="font-family: 宋体;">的一个高质量附加软件包项目。</span></span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;"><span style="white-space:pre"> </span>EPEL<span style="font-family:宋体;">的软件包通常不会与企业版</span><span style="font-family:Arial;">Linux</span><span style="font-family:宋体;">官方源中的软件包发生冲突，或者互相替换文件。</span></span></p>
<p>  <span style="font-size:10.5pt;font-family:Arial;">安装方法：</span></p>
<p><pre>`sudo yum install epel-release</pre></p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="http://localhost/2014/11/26/CentOS-7安装完第一步：yum源配置/" data-id="cimvrqg1s0001kyfe92vpv59x" class="article-share-link">分享到</a>
      

      
        <a href="http://localhost/2014/11/26/CentOS-7安装完第一步：yum源配置/#ds-thread" class="article-comment-link">评论</a>
      

      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2014/12/09/Linux运维文档之nginx【转】/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">
        
          Linux运维文档之nginx【转】
        
      </div>
    </a>
  
  
    <a href="/2014/11/17/CDN，网站加速利器/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">CDN，网站加速利器</div>
    </a>
  
</nav>

  
</article>


  <section id="comments">
    <div id="ds-thread" class="ds-thread" data-thread-key="2014/11/26/CentOS-7安装完第一步：yum源配置/" data-title="CentOS 7安装完第一步：yum源配置" data-url="http://localhost/2014/11/26/CentOS-7安装完第一步：yum源配置/"></div>
  </section>
</section>
      
      <aside id="sidebar">
  
    
  
    
  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/">五月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/04/">四月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">十二月 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">十一月 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">七月 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">六月 2014</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">近期文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2015/05/01/Linux服务器配置与LNMP安装实录-1/">Linux服务器配置与LNMP安装实录---(1)</a>
          </li>
        
          <li>
            <a href="/2015/04/16/科学上网，简易教程/">科学上网，简易教程</a>
          </li>
        
          <li>
            <a href="/2014/12/17/记Fedora-21-Yun源配置和软件安装/">记Fedora 21 Yun源配置和软件安装</a>
          </li>
        
          <li>
            <a href="/2014/12/09/Linux运维文档之nginx【转】/">Linux运维文档之nginx【转】</a>
          </li>
        
          <li>
            <a href="/2014/11/26/CentOS-7安装完第一步：yum源配置/">CentOS 7安装完第一步：yum源配置</a>
          </li>
        
      </ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">友情链接</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="http://xiguabaobao.com" target="_blank">主题作者</a>
          </li>
        
          <li>
            <a href="http://reqianduan.com" target="_blank">热前端</a>
          </li>
        
          <li>
            <a href="https://www.xiyoulinux.org" target="_blank">西邮linux兴趣小组</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
      
    </div>
    <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 wangbo<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
      .
      Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape-plus</a>
    </div>
  </div>
</footer>
  </div>
  <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
  <!-- totop start -->
<div id="totop">
<a title="返回顶部"><img src="/img/scrollup.png"/></a>
</div>

<!-- totop end -->

<!-- 多说公共js代码 start -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"idina"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0]
     || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
  </script>
<!-- 多说公共js代码 end -->


<!-- 百度分享 start -->

<!-- 百度分享 end -->

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>




<script src="/js/script.js"></script>

</div>
</body>
</html>
